package homework;
import java.util.Scanner;
public class Demo4 {
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.println("请输入整数n: ");
    int n = scanner.nextInt();
    System.out.println(jc(n));
}
    public static int jc(int n) {
        int sum=1;
        if (n<0){
            System.out.println("输入错误");
        }else if (n==0||n==1){
            System.out.println(n+"的阶层为1");
        }else {
            for (int i = 1; i <=n ; i++) {
                sum*=i;
            }
            return sum;
        }
        return sum;
    }
}


